package com.usf.jprovider.schema.selector.entry;

import com.usf.jprovider.constants.Constants;
import com.usf.jprovider.object.JObjectNode;
import com.usf.jprovider.object.env.Environment;

public class NextEntry extends AbstractEntrySelector{

	
	public NextEntry() {
		super();
	}

	@Override
	protected int index(Environment env, JObjectNode node, int size) {
		String id = node.path() + Constants.NEXT_ENTRY_PREFIX;
		Integer index = (Integer)env.getCache().get(id);
		if(index == null) index = 0;
		else index = ((index + 1) % size);
		env.getCache().put(id, index);
		return index;
	}
	@Override
	protected int startIndex(Environment env,JObjectNode node, int size) {
		return 0;
	}
	@Override
	protected int endIndex(Environment env,JObjectNode node, int size) {
		return size - 1;
	}
	
	@Override
	public String selectField(Environment env, String table, String column) {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public String selectField(Environment env, String table, String column,
			String queryValue) {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public String selectQuery(Environment env, String query) {
		// TODO Auto-generated method stub
		return null;
	}
}
